<?php
			
	/* SVN FILE: $Id: tooltip.php 8 2011-03-13 08:32:38Z michele.andreoletti@gmail.com $ */
	
	/**
	* Project Name : arcadia
	*
	* @author $Author: michele.andreoletti@gmail.com $
	* @version $Revision: 8 $
	* @lastrevision $Date: 2011-03-13 08:32:38 +0000 (Sun, 13 Mar 2011) $
	* @filesource $URL: http://arcadia.googlecode.com/svn/trunk/budget/tooltip.php $
	*/

	require_once 'include/functions.php';
	require_once 'include/const.inc.php';
	require_once '../include/auth.inc.php';
	require_once '../include/conn.inc.php';
	
	fnGetValueFromGET(array('sField','iView','sTable'));

	$iAccessLvl = fnViewAccessLvl($iView, $aTABLE, $aTABLE_SECURITY_CHECK);
	
	fnViewConst($aTABLE[$sTable]['sViewItemLink']);
		
	$aData = fnCheckView($iView, $sViewSelectFrom, $sViewSelectGroupBy, 'aData');
	
	if (is_allowed('view', $iAccessLvl) && !empty($aData)) {
	
		$html = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
					<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='it' lang='it'>
					<head>
						<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
					</head>
					<body><div class='tooltip'>";

		if ($sField == 'iShowDetails') {
			
			// $aFieldsDataType
			fnFieldsDataTypeArray($sViewSelectFrom);
			
			$html .= fnShowTooltipField('sRichiesta','RICHIESTA');
			$html .= fnShowTooltipField('dtRichiesta','DATA RICHIESTA');
			$html .= fnShowTooltipField('sUnita',"UNITA'");
			$html .= "<br/>";
							
			$html .= fnShowTooltipField('sApparecchiatura','APPARECCHIATURA');
			$html .= fnShowTooltipField('sPriorita',"PRIORITA'");
			$html .= "<br/>";
						
			$html .= fnShowTooltipField('sQuantita',"Q.TA'");
			
			if (!empty($aData['sOrdine'])) {
				$html .= fnShowTooltipField('dImporto',"IMPORTO <span class='small-text'>(iva inc.)</span>",true);
				$html .= fnShowTooltipField('sOrdine',"ORDINE");
				$html .= fnShowTooltipField('sAutorizzazione',"AUTORIZZAZIONE");
				if ($aData['dtCollaudo']!='0000-00-00' || $aData['sCollaudo']!='' && is_allowed('view', fnFieldAccessLvl($iAccessLvl, 0, 'dtCollaudo'))) {
					$html .= "<img src='images/award_star_gold_2.png' border='0'>&nbsp;<span class='label'>COLLAUDO ESEGUITO IL ".date_convert($aData['dtCollaudo'],'html')."</span><br/>";
				}
			} else {
				$html .= fnShowTooltipField('dPreventivo',"PREVENTIVO <span class='small-text'>(iva inc.)</span>",true);
				$html .= fnShowTooltipField('iStato',"ORDINE IN CORSO");
			}
				
			if (isset($aData['sNote']) && !empty($aData['sNote'])) {
				$html .= "<br/>";
				$html .= fnShowTooltipField('sNote','NOTE');
			}
			
			//
			if (isset($aRow['sConsumi']) && !empty($aData['sConsumi'])) {
				$html .= "<br/>";
				$html .= fnShowTooltipField('consumi','CONSUMI INDOTTI');
			}
		
			// categorie
			if (is_allowed('view', fnFieldAccessLvl($iAccessLvl, 0, 'tags'))) {
				$html .= "<br/>";
				$html .= fnTagsView('view', $aData['id'], $sTable, '', $sAPP, false, false, false);					
			} 	
		
		
		} else if ($sField == 'iShowNote' || true) {
			
			$iFieldAccessLvl = fnFieldAccessLvl($iAccessLvl, 0, $sField);
			if (is_allowed('view', $iFieldAccessLvl)) { 
				$html .= "	<span class='$sField'>".nl2br($aData['sNote'])."</span>";
			}
			
		}
		
		$html .= "	<div class='endpage'>&nbsp;</div>";
		
		$html .= "	</div></body>";
		
		echo $html;
	
	} else {
	
		if (!is_allowed('view', $iAccessLvl))
			fnUpdateLog('LOW RIGHTS', $iView, $sViewSelectFrom,'S');

		if (empty($aData))
			fnUpdateLog('RECORD NOT FOUND', $iView, $sViewSelectFrom,'E');
		
		echo '';
		
	}
	
?>